/*
** my_strcmp.c for my_strcmp in /home/gueux_g/piscine/Jour_06
**
** Made by gregory gueux
** Login   <gueux_g@epitech.net>
**
** Started on  Mon Oct  8 20:24:12 2012 gregory gueux
** Last update Mon Nov 12 15:32:08 2012 gueux-g
*/

typedef struct s_valeur
{
  int	i;
  int	k;
  int	j;
  int	values;
} t_valeur;

char	*my_strstr(char *str, char *to_find)
{
  t_valeur	*data;

  data = (void *)xmalloc(sizeof(*data));
  data->i = 0;
  data->k = 0;
  data->j = 0;
  while (str[data->i])
    {
      if (str[data->i] == to_find[data->j])
	{
	  data->k = data->i;
	  while ((to_find[data->j] == str[data->i]) &&to_find[data->j])
	    {
	      data->j++;
	      data->i++;
	    }
	  if (to_find[data->j] == 0)
	    {
	      data->i = data->k;
	      str = str + data->i;
	      return (str);
	    }
	  else
	    {
	      data->i = data->k;
	      data->j = 0;
	    }
	}
      data->i++;
    }
  return ("\0");
}
